class Solution:
    def minFlipsMonoIncr(self, s: str) -> int:
        dp = [0, 0]
        for i in range(len(s)):
            if s[i] == '1':
                dp[0] += 1
            else:
                dp[1] += 1
            dp[1] = min(dp[0], dp[1])
        return min(dp[0], dp[1])